<?php
class ImageFactory extends DeanFactory{
	
	private static $_instance;
		

	public static function getInstance() {
		if(is_null(self::$_instance)){
			self::$_instance = new ImageFactory();
		}
		return self::$_instance;
	}
	
	public function displayProfileImage($image_id){
		$this->logger->info("ImageFactory::displayImage > image_id = $image_id");
		
		$imageModel = new ImageModel("image", "image_id");
		$content = $imageModel->getImage($image_id);
		
		if($content != null)
			return "<img alt='Profile image' style='float:left' width='100px' height='100px' src='data:image/".$content['type'].";base64,".base64_encode($content['content'])."' />";
		else
			return "<img style='float:left' width='100px' height='100px' src='"."/images/unknown.gif"."' alt='Unknown profile' />";
	}
	
	
}